package com.kiwi.util;

import org.json.JSONObject;

import java.util.Iterator;

/**
 * Created by hancongcong on 2018/6/8.
 */
public class fabupopoMsgUtil {
    public static String getPopoMsg(String json) {
        json = json
                .replace("productName", "产品名")
                .replace("producter", "产品")
                .replace("backstage", "后台")
                .replace("front", "前端")
                .replace("tester", "测试")
                .replace("branch", "分支")
                .replace("fabuSystem", "发布系统")
                .replace("codereView", "代码审查")
                .replace("schedule", "是否排期中")
                .replace("sqlValid", "是否SQL更改")
                .replace("functionName", "功能名称")
        ;
        JSONObject jsonObject = new JSONObject(json);
        Iterator iterator = jsonObject.keys();
        while (iterator.hasNext()) {
            String key = iterator.next().toString();
            String value = jsonObject.get(key).toString();
            System.out.println(key + "：" + value);
        }

        return json;
    }

    /*{
        "productName": "Hi玩",
            "functionName": "嗨玩三期、四期后台管理系统",
            "producter": "闫丽君",
            "backstage": "王薇华 高磊",
            "front": "王薇华 高磊",
            "tester": "白龙宝解婷婷程文璞夏卉芳",
            "branch": "后台分支:f_gaoleiboru_20180516_v4;前端分支:f_haiwan_180519_wwh",
            "fabuSystem": "admin.ms   admin.game",
            "codereView": null,
            "schedule": "是",
            "sqlValid": "否"
    }*/
    public static void main(String[] argv) {
        getPopoMsg("\"fabuSystem\": \"grassland（只发前端）\",\n" +
                "\t\"productId\": \"2018082410TPRM03292147\",\n" +
                "\t\"backstage\": \"无\",\n" +
                "\t\"tester\": \"韩聪聪 &  夏卉芳\",\n" +
                "\t\"branch\": \"后台分支:无;前端分支:f_20180812_optimize\",\n" +
                "\t\"schedule\": \"是\",\n" +
                "\t\"sqlValid\": \"否\",\n" +
                "\t\"productName\": \"Hi玩\",\n" +
                "\t\"fronter\": \"张瑞\",\n" +
                "\t\"codereView\": \"无\",\n" +
                "\t\"issueKey\": null,\n" +
                "\t\"insertTime\": \"2018-8-24.10.30. 28. 0\",\n" +
                "\t\"producter\": \"闫丽君；王福昆\",\n" +
                "\t\"functionName\": \"【grassland】草原运动会四期 & CDN分离\",\n" +
                "\t\"status\": \"1\"");  }
}
